﻿//using System;
//using System.Collections.Generic;
//using System.Drawing;
//using System.Linq;
//using System.Text;
//using Habanero.Faces.Base;
//using Habanero.Faces.Win;
//using ICSharpCode.TextEditor;
//using ICSharpCode.TextEditor.Addons;
//using ICSharpCode.TextEditor.Document;

//namespace FireStarterModeller.UI
//{
//    public class XmlTextEditor : TextEditorControl, IControlHabanero
//    {
//        public XmlTextEditor()
//        {
//            base.Document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategy("XML");
//            base.Document.FoldingManager.FoldingStrategy = new XmlFoldingStrategy();
//            base.Document.FormattingStrategy = new XmlFormattingStrategy();
//            base.TextEditorProperties = InitializeProperties();
//            base.Document.FoldingManager.UpdateFoldings(string.Empty, null);
//            base.TextArea.Refresh(base.TextArea.FoldMargin);
//            base.Document.DocumentChanged += this.Document_DocumentChanged;
//        }

//        private void Document_DocumentChanged(object sender, DocumentEventArgs e) {

//            base.Document.FoldingManager.UpdateFoldings(string.Empty, null);
//            base.TextArea.Refresh(base.TextArea.FoldMargin);

//            //if (this.Presenter == null) return;
//            //if (this.Text == Environment.NewLine && string.IsNullOrEmpty(this.presenter.Text)) return;

//            //this.Presenter.Text = this.Text;
//        }

//        private static ITextEditorProperties InitializeProperties()
//        {
//            var properties = new DefaultTextEditorProperties();
//            properties.Font = new Font("Courier new", 9, FontStyle.Regular);
//            properties.IndentStyle = IndentStyle.Smart;
//            properties.ShowSpaces = false;
//            properties.LineTerminator = Environment.NewLine;
//            properties.ShowTabs = false;
//            properties.ShowInvalidLines = false;
//            properties.ShowEOLMarker = false;
//            properties.TabIndent = 2;
//            properties.CutCopyWholeLine = true;
//            properties.LineViewerStyle = LineViewerStyle.None;
//            properties.MouseWheelScrollDown = true;
//            properties.MouseWheelTextZoom = true;
//            properties.AllowCaretBeyondEOL = false;
//            properties.AutoInsertCurlyBracket = true;
//            properties.BracketMatchingStyle = BracketMatchingStyle.After;
//            properties.ConvertTabsToSpaces = false;
//            properties.ShowMatchingBracket = true;
//            properties.EnableFolding = true;
//            properties.ShowVerticalRuler = false;
//            properties.IsIconBarVisible = true;
//            properties.Encoding = System.Text.Encoding.Unicode;
//            properties.UseAntiAliasedFont = false;
//            return properties;
//        }

//        /// <summary>
//        /// Gets or sets the anchoring style.
//        /// </summary>
//        /// <value></value>
//        AnchorStyles IControlHabanero.Anchor
//        {
//            get { return (AnchorStyles)base.Anchor; }
//            set { base.Anchor = (AnchorStyles)value; }
//        }

//        /// <summary>
//        /// Gets the collection of controls contained within the control
//        /// </summary>
//        IControlCollection IControlHabanero.Controls
//        {
//            get { return new ControlCollectionWin(base.Controls); }
//        }

//        /// <summary>
//        /// Gets or sets which control borders are docked to its parent
//        /// control and determines how a control is resized with its parent
//        /// </summary>
//        DockStyle IControlHabanero.Dock
//        {
//            get
//            {
//                return DockStyleWin.GetDockStyle(base.Dock);
//            }
//            set
//            {
//                base.Dock = DockStyleWin.GetDockStyle(value);

//            }
//        }
//    }
//}
